package com.roadjava.tutor.bean.dto;

import com.roadjava.tutor.bean.entity.TeacherJob;
import com.roadjava.tutor.util.DateUtil;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 老师发布的求职信息
 * @author zhaodaowen
 * @see <a href="http://www.roadjava.com">乐之者java</a>
 */
@Data
public class TeacherJobDTO extends BaseDTO{
    /**
     * 主键
     */
    private Long id;
    /**
     * 求职名称
     */
    private String title;
    /**
     * 课程名
     */
    private String courseName;
    /**
     * 求职信息详细描述
     */
    private String detailDesc;
    /**
     * 计费规则
     */
    private BigDecimal chargingRule;
    /**
     * 发布时间
     */
    private String publishTime;
    /**
     * 发布的教师的id
     */
    private Long teacherId;
    /**
     * 搜索类型
     */
    private String searchType;
    /**
     * 搜索词
     */
    private String searchWord;
    /**
     * 当前登录的学生id,用于查询这个学生是否已经预约过该条求职
     */
    private Long crtStudentId;
    public TeacherJob toEntity() {
        TeacherJob entity = new TeacherJob();
        BeanUtils.copyProperties(this,entity, "publishTime");
        entity.setPublishTime(DateUtil.str2Date(publishTime));
        return entity;
    }
}
